<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>onblur</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="../../jsfile/layer.css"/>
    <script src="../../jsfile/jquery.js"></script>
    <script src="../../jsfile/layer.js"></script>
    <script src="../../jsfile/base.js"></script>

    <script type="text/javascript">
        //静态注册表单 提交事务
        function onsubmitFun(){
            alert("静态注册表单相是否合法,如果有一个不合法就阻止表单提交");
            return false;
        }

        //动态注册提交事件
        window.onload = function (){
            //1.获取标签对象
            var formObj = document.getElementById("form01");
            //2.通过标签对象.事件名 = function(){}
            formObj.onsubmit = function (){
                //要验证所有的表单项是否合法,如果,有一个不合法就阻止表单提交
                alert("动态注册表单提交 ---- 发现不合法");
                return false;
            }
        }
    </script>

</head>
<body>
<p id="text_show">
onsubmit
</p>
<div class="look_source_code" onclick="getPageContent()">查看源码</div>

<!--return false 可以阻止表单提交-->
<form action="http://localhost" method="get" onsubmit="return onsubmitFun()">
    <input type="submit" value="静态注册" />
</form>

<!--动态验证表单，进行提交-->
<form action="http://localhost" id="form01">
    <input type="submit" value="动态注册" />
</form>

</body>


</html>


